package com.bluesky.jwf.util.state;

import javax.servlet.http.HttpServletRequest;

import com.bluesky.jwf.component.Page;
import com.bluesky.jwf.component.window.MainWindow;
import com.bluesky.jwf.util.ServletContext;

public class SessionStateHandler extends AbstractStateHandler implements
		StateHandler {
	public static String MAIN_WINDOW_IN_SESSION = "_jwf_main_window_in_session";
	
	@Override
	public Object get(HttpServletRequest req, ServletContext context) {
		Object obj = req.getSession().getAttribute(
				MAIN_WINDOW_IN_SESSION);

		return obj;
	}

	@Override
	public void store(HttpServletRequest req, MainWindow window, Page page) {
		req.getSession()
				.setAttribute(MAIN_WINDOW_IN_SESSION, window);
	}

}
